package com.visikard.item;

import java.io.Serializable;

import org.json.JSONObject;

public class ItemGiftKardRedeem implements Serializable {

	private static final long serialVersionUID = 1L;

	double cert_value;
	String giftango_cert_id_string;
	String dateTime;
	String merchantName;
	int isGiftKard;
	int categoryKard;
	String imgCard;
	String imgThumbnail;
	String redeemedCode;
	long idGiftItem;
	String cardNameReceiver;
	String cardNameSender;
	String cert_barcode_url;
	String cert_terms_conditions;
	String cert_cashier_instructions;
	long idTransaction;
	String virtual_cert_landing_link;
	String email_cert_card_image_url;
	String email_cert_mobile_card_image_url;
	String partner_cert_id_string;
	String giftango_pin_id_string;
	String imgFolder;
	long giftKardUserId;
	String cert_barcode_text;
	long merchantId;
	String purchase_value;
	String message;
	String currency;
	int isOffer;
	String campaignDetail;
	private int campaignType;
	private int activeFunkKard;
	private int requireBuy;

	public ItemGiftKardRedeem() {
	}

	public ItemGiftKardRedeem(JSONObject job) {
		if (job == null)
			return;
		try {
			cert_value = job.optDouble("cert_value", 0);
			giftango_cert_id_string = job.optString("giftango_cert_id_string",
					"");
			if (giftango_cert_id_string.equals("null")) {
				giftango_cert_id_string = "";
			}
			dateTime = job.optString("dateTime", "");
			if (dateTime.equals("null")) {
				dateTime = "";
			}
			merchantName = job.optString("merchantName", "");
			if (merchantName.equals("null")) {
				merchantName = "";
			}
			isGiftKard = job.optInt("isGiftKard", -1);
			categoryKard = job.optInt("categoryCard", -1);
			imgCard = job.optString("imgCard", "");
			if (imgCard.equals("null")) {
				imgCard = "";
			}
			imgThumbnail = job.optString("imgThumbnail", "");
			if (imgThumbnail.equals("null")) {
				imgThumbnail = "";
			}
			redeemedCode = job.optString("redeemedCode", "");
			if (redeemedCode.equals("null")) {
				redeemedCode = "";
			}
			idGiftItem = job.optLong("idGiftItem", -1);
			cardNameReceiver = job.optString("cardNameReceiver", "");
			if (cardNameReceiver.equals("null")) {
				cardNameReceiver = "";
			}
			cardNameSender = job.optString("cardNameSender", "");
			if (cardNameSender.equals("null")) {
				cardNameSender = "";
			}
			cert_barcode_url = job.optString("cert_barcode_url", "");
			if (cert_barcode_url.equals("null")) {
				cert_barcode_url = "";
			}
			cert_terms_conditions = job.optString("cert_terms_conditions", "");
			if (cert_terms_conditions.equals("null")) {
				cert_terms_conditions = "";
			}
			cert_cashier_instructions = job.optString(
					"cert_cashier_instructions", "");
			if (cert_cashier_instructions.equals("null")) {
				cert_cashier_instructions = "";
			}
			idTransaction = job.optLong("idTransaction", -1);
			virtual_cert_landing_link = job.optString(
					"virtual_cert_landing_link", "");
			if (virtual_cert_landing_link.equals("null")) {
				virtual_cert_landing_link = "";
			}
			email_cert_card_image_url = job.optString(
					"email_cert_card_image_url", "");
			if (email_cert_card_image_url.equals("null")) {
				email_cert_card_image_url = "";
			}
			email_cert_mobile_card_image_url = job.optString(
					"email_cert_mobile_card_image_url", "");
			if (email_cert_mobile_card_image_url.equals("null")) {
				email_cert_mobile_card_image_url = "";
			}
			partner_cert_id_string = job
					.optString("partner_cert_id_string", "");
			if (dateTime.equals("null")) {
				dateTime = "";
			}
			giftango_pin_id_string = job
					.optString("giftango_pin_id_string", "");
			if (giftango_pin_id_string.equals("null")) {
				giftango_pin_id_string = "";
			}
			imgFolder = job.optString("imgFolder", "");
			if (imgFolder.equals("null")) {
				imgFolder = "";
			}
			giftKardUserId = job.optLong("giftKardUserId", -1);
			cert_barcode_text = job.optString("cert_barcode_text", "");
			if (cert_barcode_text.equals("null")) {
				cert_barcode_text = "";
			}
			merchantId = job.optLong("merchantId", -1);
			purchase_value = job.optString("purchase_value", "0");
			message = job.optString("message", "");
			currency = job.optString("currency", "");
			if (currency.equals("null")) {
				currency = "";
			}
			isOffer = job.optInt("isOffer", -1);
			campaignDetail = job.optString("campaignDetail", "");
			if (campaignDetail.equals("null")) {
				campaignDetail = "";
			}
			setCampaignType(job.optInt("campaignType", -1));
			setActiveFunkKard(job.optInt("activeFunkKard", -1));
			setRequireBuy(job.optInt("requireBuy", -1));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public double getCert_value() {
		return cert_value;
	}

	public String getGiftango_cert_id_string() {
		return giftango_cert_id_string;
	}

	public String getDateTime() {
		return dateTime;
	}

	public String getMerchantName() {
		return merchantName;
	}

	public int getIsGiftKard() {
		return isGiftKard;
	}
	
	public int getCategoryKard() {
		return categoryKard;
	}

	public String getImgCard() {
		return imgCard;
	}

	public String getImgThumbnail() {
		return imgThumbnail;
	}

	public String getRedeemedCode() {
		return redeemedCode;
	}

	public long getIdGiftItem() {
		return idGiftItem;
	}

	public String getCardNameReceiver() {
		return cardNameReceiver;
	}

	public String getCardNameSender() {
		return cardNameSender;
	}

	public String getCert_barcode_url() {
		return cert_barcode_url;
	}

	public String getCert_terms_conditions() {
		return cert_terms_conditions;
	}

	public String getCert_cashier_instructions() {
		return cert_cashier_instructions;
	}

	public long getIdTransaction() {
		return idTransaction;
	}

	public String getVirtual_cert_landing_link() {
		return virtual_cert_landing_link;
	}

	public String getEmail_cert_card_image_url() {
		return email_cert_card_image_url;
	}

	public String getEmail_cert_mobile_card_image_url() {
		return email_cert_mobile_card_image_url;
	}

	public String getPartner_cert_id_string() {
		return partner_cert_id_string;
	}

	public String getGiftango_pin_id_string() {
		return giftango_pin_id_string;
	}

	public String getImgFolder() {
		return imgFolder;
	}

	public long getGiftKardUserId() {
		return giftKardUserId;
	}

	public String getCert_barcode_text() {
		return cert_barcode_text;
	}

	public long getMerchantId() {
		return merchantId;
	}

	public String getPurchase_value() {
		return purchase_value;
	}
	
	public double getPurchase_numbervalue(){
		try{
//			String strValue = purchase_value.split("$")[0];
			String strValue = purchase_value.substring(1, purchase_value.length());
			return Double.parseDouble(strValue);
		}catch(Exception e){
			return 0;
		}
		
	}

	public String getMessage() {
		return message;
	}

	public String getCurrency() {
		return currency;
	}

	public int getIsOffer() {
		return isOffer;
	}

	public String getCampaignDetail() {
		return campaignDetail;
	}

	public int getCampaignType() {
		return campaignType;
	}

	public void setCampaignType(int campaignType) {
		this.campaignType = campaignType;
	}

	public int getActiveFunkKard() {
		return activeFunkKard;
	}

	public void setActiveFunkKard(int activeFunkKard) {
		this.activeFunkKard = activeFunkKard;
	}

	public int getRequireBuy() {
		return requireBuy;
	}

	public void setRequireBuy(int requireBuy) {
		this.requireBuy = requireBuy;
	}
}
